package com.budwk.app.sqfw.controllers.admin.guiyang.nanming;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.alibaba.fastjson.JSONObject;
import com.budwk.app.sqfw.component.CommunityStreetComponent;
import com.budwk.app.sqfw.enums.GasA20Enum;
import com.budwk.app.sqfw.enums.RiskA17Enum;
import com.budwk.app.sqfw.models.Sqfw_formSummary;
import com.budwk.app.sqfw.services.SecurityInvestigationService;
import com.budwk.app.sqfw.vo.Sqfw_formSummaryForAdminVO;
import com.budwk.starter.common.openapi.annotation.*;
import com.budwk.starter.common.result.Result;
import com.budwk.starter.log.annotation.SLog;
import lombok.extern.slf4j.Slf4j;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.*;

/**
 * @author ZY.Wang
 * @since 2023/10/23
 */
@IocBean
@At("/platform/sqfw/guiyang/huaguoyuan")
@ApiDefinition(tag = "贵阳南明区花果园街道（双塔社区）接口")
@Slf4j
public class HuaGuoYuanController {

    @Inject
    private CommunityStreetComponent communityStreetComponent;

    @Inject(value = "huaGuoYuanStreetService")
    private SecurityInvestigationService investigationService;

    @At()
    @Ok("json")
    @POST
    @ApiOperation(name = "后台管理系统任务列表查询")
    @ApiFormParams(implementation = Sqfw_formSummaryForAdminVO.class)
    @ApiResponses(implementation = Sqfw_formSummary.class)
    @SaCheckLogin
    public Result<?> listSummaryByPage(@Param("..") Sqfw_formSummaryForAdminVO forAdminVo) {
        log.info("huaguoyuan listSummaryByJY param: {}", JSONObject.toJSONString(forAdminVo));
        return investigationService.listSummaryByPage(forAdminVo);
    }

    @At()
    @Ok("json")
    @GET
    @ApiOperation(name = "○燃气使用情况：需要穷举： 全部 / 无 / 使用醇基 / 使用液化气 / 用电；搜索a20")
    @SaCheckLogin
    public Result<?> listGasData() {
        return Result.data(GasA20Enum.listNams());
    }

    @At()
    @Ok("json")
    @GET
    @ApiOperation(name = "风险评估： 需要穷举： 全部 / 无 /  一般风险 / 较大风险 / 重大风险 / 特大风险；可复选；搜索a17")
    @SaCheckLogin
    public Result<?> listrRiskData() {
        return Result.data(RiskA17Enum.listNams());
    }

    @At()
    @Ok("json")
    @DELETE
    @ApiOperation(name = "根据id删除数据")
    @ApiImplicitParams(@ApiImplicitParam(name = "sqfwFormSummaryId", description = "当前操作数据id", required = true, check = true))
    @ApiImplicitParam(name = "sqfwFormSummaryId", description = "当前操作数据id", required = true, check = true)
    @SLog(tag = "花果园街道：根据id删除数据", value = "${args[0]}")
    @SaCheckLogin
    public Result<?> deleteById(@Param("sqfwFormSummaryId") String sqfwFormSummaryId) {
        log.info("huaguoyuan deleteById param: {}", sqfwFormSummaryId);
        communityStreetComponent.deleteFormSummary(sqfwFormSummaryId);
        return Result.success();
    }

    @At()
    @Ok("json")
    @POST
    @ApiOperation(name = "查询导出：按照条件导出PDF,根据服务记录id数组生成pdf合集zip")
    @ApiFormParams(implementation = Sqfw_formSummaryForAdminVO.class)
    @SaCheckLogin
    public Result<?> generateServiceRecordPdfCollZipForBM(@Param("..") Sqfw_formSummaryForAdminVO bean) {
        return Result.data(investigationService.generateServiceRecordPdfCollZipForBM(bean));
    }

    @At()
    @Ok("json")
    @POST
    @ApiOperation(name = "查询导出：按照条件导出excel, 根据服务记录id和汇总Id数组生成Excel合集")
    @ApiFormParams(implementation = Sqfw_formSummaryForAdminVO.class)
    @SaCheckLogin
    public Result<?> generateServiceRecordExcelCollZipForBM(@Param("..") Sqfw_formSummaryForAdminVO bean) {
        return Result.data(investigationService.generateServiceRecordExcelCollZipForBM(bean));
    }
}
